<tr id="<%= spree_dom_id stock_location %>" data-controller="row-link" class="cursor-pointer">
  <td data-action="click->row-link#openLink"><%= stock_location.display_name %></td>
  <td data-action="click->row-link#openLink">
    <%= flag_emoji(stock_location.country_iso) %>
    <%= stock_location.country_name %>
  </td>
  <td data-action="click->row-link#openLink">
    <%= active_badge(stock_location.active?) %>
  </td>
  <% if can?(:mark_as_default, Spree::StockLocation) %>
    <td data-action="click->row-link#openLink"><%= active_badge(stock_location.default?) %></td>
  <% end %>
  <td class="actions">
    <% if can? :edit, stock_location %>
      <div class="d-flex justify-content-end align-items-center">
        <div><%= link_to_edit stock_location, data: { row_link_target: 'link', turbo_frame: '_top' } %></div>

        <% if !stock_location.default? && can?(:mark_as_default, Spree::StockLocation) %>
          <%= dropdown do %>
            <%= dropdown_toggle class: 'btn-sm h-100' do %>
              <%= icon('dots-vertical', class: 'mr-0') %>
            <% end %>
            <%= dropdown_menu do %>
              <%= link_to_with_icon 'check',
                Spree.t(:mark_as_default),
                spree.mark_as_default_admin_stock_location_path(stock_location),
                class: 'dropdown-item',
                data: { turbo_method: :put } %>
            <% end %>
          <% end %>
        <% end %>
        </div>
      </div>
    <% end %>
  </td>
</tr>
